package com.itheima.reggie.mapper;

import com.itheima.reggie.entity.Orders;
import com.itheima.reggie.entity.Orders2;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderMapper {
    @Insert("insert into orders values(#{id},#{number},#{status},#{userId},#{addressBookId},#{orderTime},#{checkoutTime},#{payMethod},#{amount},#{remark},#{phone},#{address},#{userName},#{consignee})")
    void save(Orders orders);

    @Select("select * from orders where user_id=#{userId} order by order_time desc")
    List<Orders> getNewPageByUid(Long userId);

    List<Orders> findByNumberAnd(@Param("number") String number, @Param("beginTime") String beginTime, @Param("endTime") String endTime);

    @Select("select * from orders")
    List<Orders> findAll();
}
